<div class="grid_15">
<script>
	$(document).ready(function() {
		$('#instructorSearchField').autocomplete({
			source : rd.getBaseUrl() + 'json/autocomplete/instructororproxy/',
			minLength : 2,
			select : function(event,ui) {
				this.value = ui.item.label;
				$('#searchInstructorResult').val(ui.item.value);
				//this.form.submit();
				return false;
			}
		});
	});
</script>
<?php 
$searchTerm = '';
$searchTermErrorErrorClass = '';
$instructorErrorClass = Rd_Layout::hasMessage('instructorMatchError') ? ' error' : '';
$instructorFieldValue = (
	$this->instructorFieldValue
	? "value=\"$this->instructorFieldValue\""
	: ''
);
$instructorValue = (
	$this->instructorValue
	? "value=\"$this->instructorValue\""
	: ''
);
?>
<div class="cancelNavigation">[ <a href="./?cmd=editClass&ci=<?php print($this->ci); ?>">Cancel</a> ]</div>
<div class="grid_7">
	<h2 class="formHeader grid_5">SEARCH ARCHIVED MATERIALS</h2>
	<form class="bordered clearing basicPadding bottomMargin" action="./" method="get" name="searchByDepartment">
		<input type="hidden" name="cmd" value="<?php print($this->cmd);?>" />
		<label class=" bottomHalfMargin<?php print($searchTermErrorErrorClass); ?>">
			<span class="labelText accessibleHidden">Search Field: </span>
			<?php $this->getDisplayer()->renderSelect(array(
			'options' => array(
				'Title' => 'Title',
				'Author' => 'Author'
			),
			'name' => 'searchField'
		)); ?>
		</label>
		<label class=" bottomHalfMargin<?php print($searchTextErrorErrorClass); ?>">
			<span class="labelText accessibleHidden">Search Text: </span>
			<input type="text" name="searchTerm" id="searchTerm" <?php print($searchTerm); ?> size="40" />
			
			<?php if ($searchTermErrorErrorClass) { ?>	
				<span class="formAlertMessage supplementText failedText"><?php print(Rd_Layout::getMessage('searchError'));?></span>
			<?php } ?>
		</label>
		<input type="hidden" name="ci" value="<?php print($this->ci); ?>"/>
		<input type="submit" name="searchCourseSubmit" value="Find Items" />
	</form>
</div>
<div class="grid_7 prefix_1">
	<h2 class="formHeader grid_5">SEARCH BY INSTRUCTOR</h2>
	<form class="bordered clearing basicPadding bottomMargin" action="./" method="get" name="searchByInstructor">
		<input type="hidden" name="cmd" value="<?php print($this->cmd);?>" />
		<label class=" bottomHalfMargin<?php print($instructorErrorClass); ?>">
			<span class="labelTextShort">Name: </span>
			<input type="text" name="searchInstructor" id="instructorSearchField" <?php print($instructorFieldValue); ?> size="40" />
			<?php if ($instructorErrorClass) { ?>	
				<span class="formAlertMessage supplementText failedText"><?php print(Rd_Layout::getMessage('instructorMatchError'));?></span>
			<?php } ?>
		</label>
		<input type="hidden" name="searchInstructorResult" id="searchInstructorResult" <?php print($instructorValue); ?>/>
		<input type="hidden" name="ci" value="<?php print($this->ci); ?>"/>
		<input type="submit" name="searchCourseSubmit" value="Find Items" />

	<?php if (count($this->instructorList) > 0) { ?>
		<h3 class="topMargin"> Matching Instructors</h3>
		<div>
			<ul class="discList">
		<?php foreach ($this->instructorList as $userId => $userDisplay) {
				$params = '&searchInstructorResult=' . $userId
					. '&searchInstructor=' . $this->instructorFieldValue
					. '&ci=' . $this->ci;
			?>
					<li><a href="./?cmd=<?php print($this->cmd . $params);?>"><?php print($userDisplay); ?></a></li>
		<?php } ?>
			</ul>
		</div>
	<?php } ?>
	</form>
</div>
<div class="clearing"></div>
<div class="policyNotice">
	<p>You may also <a href="<?php print($this->catalogUrl);?>">search the library's full 
	collection</a> for items to place on reserve: </p>
	<ul>
		<li>Use the &quot;Add to List&quot; buttons to collect one or more items, </li>
		<li>then click the link to your &quot;List&quot; </li>
		<li>and use the &quot;Add to Course Reserves&quot; link on your list page to request the items for your course.</li></ul>
</div>
</div>
<?php 

/*
		echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n";
		echo "	<tbody>\n";
		echo "		<tr><td width=\"100%\"><img src=\"public/images/spacer.gif\" width=\"1\" height=\"5\"> </td></tr>\n";
		echo "		<tr>\n";
        echo "			<td align=\"left\" valign=\"top\">\n";
        echo "				<table border=\"0\" align=\"center\" cellpadding=\"10\" cellspacing=\"0\">\n";
		echo "					<tr align=\"left\" valign=\"top\" class=\"headingCell1\">\n";
        echo "						<td width=\"50%\">Search for Archived Materials</td><td width=\"50%\">Search by Instructor</td>\n";
        echo "					</tr>\n";

        echo "					<tr>\n";
        //		SEARCH BY Author or Title
        echo "						<td width=\"50%\" class=\"borders\" align=\"center\">\n";
        echo "							<br>\n";
        echo "							<form action=\"index.php\" method=\"post\">\n";
        echo "							<input type=\"text\" name=\"query\" size=\"25\">\n";
        echo "							<input type=\"hidden\" name=\"page\" value=\"$page\">\n";
		echo "							<input type=\"hidden\" name=\"cmd\" value=\"$cmd\">\n";
        if (!is_null($ci)) echo "							<input type=\"hidden\" name=\"ci\" value=\"$ci\">\n";
        //echo "							<br>\n";
        echo "							<select name=\"field\">\n";
        echo "								<option value=\"Title\" selected>Title</option><option value=\"Author\">Author</option>\n";
        echo "							</select>\n";
        //echo "							<br>\n";
        //echo "							<br>\n";
        echo "							<input type=\"submit\" name=\"Submit\" value=\"Find Items\">\n";
        echo "							<br>\n";
        echo "							<br>\n";
        echo "							</form>\n";
        echo "						</td>\n";

        echo "						<td width=\"50%\" align=\"left\" valign=\"top\" class=\"borders\" align=\"center\" NOWRAP>\n";
        echo "							<form method=\"post\" action=\"index.php\" name=\"frmReserveItem\">\n";
		echo "								<input type=\"hidden\" name=\"page\" value=\"$page\">\n";
		echo "								<input type=\"hidden\" name=\"cmd\" value=\"$cmd\">\n";
		echo "								<input type=\"hidden\" name=\"searchType\" value=\"reserveItem\">\n";
		echo "								<input type=\"hidden\" name=\"field\" value=\"instructor\">\n";
		if (!is_null($ci)) echo "					<input type=\"hidden\" name=\"ci\" value=\"$ci\">\n";

        echo "								<br>\n";
		echo "								<select name=\"query\">\n";
	    echo "									<option value=\"--\" selected>Choose an Instructor\n";
        foreach($instructors as $instructor)
		{
			echo "									<option value=\"" . $instructor['user_id'] . "\">" . $instructor['full_name'] . "</option>\n";
		}

        echo "								</select>\n";
        //echo "								<br>\n";
        //echo "								<br>\n";
        echo "								<input type=\"submit\" name=\"Submit2\" value=\"Get Instructor's Reserves\">\n";
        echo "							</form>\n";
        echo "						</td>\n";
        echo "					</tr>\n";
        echo "					<tr align=\"left\" valign=\"top\">\n";
		echo "						<td colspan=\"2\" class=\"borders\" align=\"center\">\n";
        echo "							<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">\n";
        echo "								<tr>\n";
        echo "									<td align=\"left\" valign=\"top\" align=\"center\">\n";
        echo "										
        echo "									</td>\n";
        echo "								</tr>\n";
        echo "							</table>\n";
        echo "						</td>\n";
        echo "					</tr>\n";
        echo "				</table>\n";
		echo "			</td>\n";
		echo "		</tr>\n";
		echo "	</tbody>\n";
		echo "</table>\n";
*/